<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>

<link th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>

<body class="gray-bg">

    <div class="container-div">

		<div class="container-div ui-layout-center">
			<div class="row">
				<div class="col-sm-12 select-info">
					<form id="user-form">
						<input type="hidden" id="deptId" name="deptId">
						<input type="hidden" id="parentId" name="parentId">
						<div class="select-list">
							<ul>
								<li>
									登录名称：<input type="text" name="loginName"/>
								</li>
								<li>
									手机号码：<input type="text" name="phonenumber"/>
								</li>
								<li>
									用户状态：<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
									<option value="">所有</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
								</select>
								</li>
								<li class="select-time">
									<label>创建时间： </label>
									<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
									<span>-</span>
									<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
								</li>
								<li>
									<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
									<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="system:user:export"><i class="fa fa-download"></i>&nbsp;导出</a>
								</li>
							</ul>
						</div>
					</form>
				</div>
		<div class="btn-group hidden-xs" id="toolbar" role="group">
			<a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="module:userinfo:add">
				<i class="fa fa-plus"></i> 新增
			</a>
			<a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.removeAll()" shiro:hasPermission="module:userinfo:remove">
				<i class="fa fa-trash-o"></i> 删除
			</a>
		</div>
			
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
			<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
			<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('module:userinfo:edit')}]];
        var removeFlag = [[${@permission.hasPermi('module:userinfo:remove')}]];
        var resetPwdFlag = [[${@permission.hasPermi('system:user:resetPwd')}]];
        var datas = [[${@dict.getType('sys_normal_disable')}]];
        var prefix = ctx + "module/userinfo"

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                sortName: "createTime",
                sortOrder: "desc",
                modalName: "用户",
                search: false,
                showExport: false,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'userId', 
					title : '用户ID' 
				},
				{
					field : 'deptId', 
					title : '部门ID' 
				},
				{
					field : 'loginName', 
					title : '登录账号' 
				},
				{
					field : 'userName', 
					title : '用户昵称' 
				},
				{
					field : 'userType', 
					title : '用户类型（00系统用户）' 
				},
				{
					field : 'email', 
					title : '用户邮箱' 
				},
				{
					field : 'phonenumber', 
					title : '手机号码' 
				},
				{
					field : 'sex', 
					title : '用户性别（0男 1女 2未知）' 
				},
				{
					field : 'avatar', 
					title : '头像路径' 
				},
				{
					field : 'password', 
					title : '密码' 
				},
				{
					field : 'salt', 
					title : '盐加密' 
				},
				{
					field : 'status', 
					title : '帐号状态（0正常 1停用）' 
				},
				{
					field : 'delFlag', 
					title : '删除标志（0代表存在 2代表删除）' 
				},
				{
					field : 'loginIp', 
					title : '最后登陆IP' 
				},
				{
					field : 'loginDate', 
					title : '最后登陆时间' 
				},
				{
					field : 'createBy', 
					title : '创建者' 
				},
				{
					field : 'createTime', 
					title : '创建时间' 
				},
				{
					field : 'updateBy', 
					title : '更新者' 
				},
				{
					field : 'updateTime', 
					title : '更新时间' 
				},
				{
					field : 'remark', 
					title : '备注' 
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>